﻿<ui:View x:Class="CPPEI.Coolzon.DisplayApp.SettingView"
       xmlns:ui="clr-namespace:CPPEI.Coolzon.UI;assembly=CPPEI.Coolzon.UI"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:convert="clr-namespace:CPPEI.Coolzon.DisplayApp"
      mc:Ignorable="d" 
      d:DesignHeight="300" d:DesignWidth="500">
    <UserControl.Resources>
        <convert:BackgroundConverter x:Key="backgroundConverter"/>
        <ui:True2VisibleConverter x:Key="true2Visible"/>
        <ui:True2HiddenConverter x:Key="true2Hidden"/>
        <ui:True2FalseConverter x:Key="true2False"/>
    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto"/>
            <ColumnDefinition Width="auto"/>
        </Grid.ColumnDefinitions>
        <Grid Grid.Column="0">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
           
        </Grid.RowDefinitions>
            <StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Center" IsEnabled="{Binding Path=IsAutoPlay, Converter={StaticResource true2False}}">
            <Button x:Name="btn_UnderControl" Click="btn_UnderControl_Click" Content="接受控制"  Margin="5" Width="100"
                    IsEnabled="{Binding Path=IsUnderControl, Converter={StaticResource true2False}}"/>
            <Button x:Name="btn_OutofControl" Click="btn_OutofControl_Click" Content="脱离控制"  Margin="5" Width="100"
                    IsEnabled="{Binding Path=IsUnderControl}"/>
        </StackPanel>
            <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center" IsEnabled="{Binding Path=IsUnderControl, Converter={StaticResource true2False}}">
                <Button x:Name="btn_BeginAutoPlay" Click="btn_BeginAutoPlay_Click" Content="自动播放"  Margin="5" Width="100"
                    IsEnabled="{Binding Path=IsAutoPlay, Converter={StaticResource true2False}}"/>
                <Button x:Name="btn_StopAutoPlay" Click="btn_StopAutoPlay_Click" Content="停止播放"  Margin="5" Width="100"
                    IsEnabled="{Binding Path=IsAutoPlay}"/>
        </StackPanel>
        <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" >
                <Button x:Name="btn_BeginFullScreen" Click="btn_BeginFullScreen_Click" Content="开始全屏"  Margin="5" Width="100"
                    IsEnabled="{Binding Path=IsFullScreen, Converter={StaticResource true2False}}"/>
                <Button x:Name="btn_StopFullScreen" Click="btn_StopFullScreen_Click" Content="退出全屏" Margin="5" Width="100"
                    IsEnabled="{Binding Path=IsFullScreen}"/>
        </StackPanel>
        <StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Center">
            <Button x:Name="btn_Quit" Click="btn_Quit_Click" Content="退出程序" Margin="5" Width="200"></Button>
        </StackPanel>
    </Grid>
        <Grid Grid.Column="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <TextBlock Name="_ctlTextNetState" Text="-" Grid.Row="0"/>
            <DataGrid x:Name="dataGridProxyState" AutoGenerateColumns="False" IsReadOnly="True" Grid.Row="1">
                <DataGrid.Columns>
                    <DataGridTextColumn Header="服务地址" Width="80" Binding="{Binding IP}"/>
                    <DataGridTextColumn Header="端口" Width="40" Binding="{Binding Port}"/>
                    <DataGridCheckBoxColumn Header="是否连接" Width="80" Binding="{Binding IsConnected}"/>
                    <DataGridTextColumn Header="延迟时间(毫秒)" Width="100" Binding="{ Binding Lag}"/>
                </DataGrid.Columns>
                <DataGrid.CellStyle>
                    <Style TargetType="DataGridCell" >
                        <Setter Property="Background" Value="{Binding Path=IsConnected, Converter={StaticResource backgroundConverter}}"/>
                    </Style>
                </DataGrid.CellStyle>
            </DataGrid>
        </Grid>
    </Grid>
</ui:View>
